<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%><%@ page import="kr.co.redcircle.oauth.authorize.SessionManager"
%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//KR" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>BizBroker SNS Gateway</title>
</head>
<body>
회사 아이디 : <%=request.getParameter("comp")%><br>
대상 컨텐츠 아이디 : <%=request.getParameter("contents")%>
<script language="javascript" src="js/prototype.js" ></script>
<script language="javascript">

	function openLoginDialog(typeid){
		window.showModalDialog('loginDialog.jsp?snsid='+typeid,'dialogHeight:200px;dialogWidth:800px;dialogLeft:300;dialogTop:500;center:yes;status:no');
	}
	function savePost(){
		var note_len = $("note_main").value.length;
		
		if (note_len > 3){
			new Ajax.Request('SavePost.jsp', {
				  method: 'post',
				  parameters: $("note_form").serialize(true),
				  onSuccess: function(transport) {
					  var targetTbody = $("SNS_RE_MAIN").tBodies[0];
					  var spacertr0 = document.createElement("TR"); 
					  var spacertr1 = document.createElement("TR");
					  var spacertd0 = document.createElement("TD"); spacertd0.colSpan = 4; spacertd0.height  = 10;
					  var spacertd1 = document.createElement("TD"); spacertd1.colSpan = 4;
	
					  
					  var contentsTableTr0 = document.createElement("TR");
					  var contentsTableTr1 = document.createElement("TR");
					  var contentsTableBody = document.createElement("TBODY"); 
					  var innerTable = document.createElement("TABLE"); 
					  
					  innerTable.border=0;
					  
					  contentsTableBody.appendChild(contentsTableTr0);
					  contentsTableBody.appendChild(contentsTableTr1);
					  innerTable.appendChild(contentsTableBody);
					  
					  spacertr0.appendChild(spacertd0);
					  spacertd1.appendChild(innerTable);
					  spacertr1.appendChild(spacertd1);
					  
					  targetTbody.appendChild(spacertr0);
					  targetTbody.appendChild(spacertr1);
		 			  
					  var jsonOBJ = transport.responseText.evalJSON();
	
					  contentsTableTr0.innerHTML = jsonOBJ.header;
					  contentsTableTr1.innerHTML = jsonOBJ.contents;
					  
					  $("note_main").value = "";
					  
				}
			});
		}

	}
	
</script>
	<table border="1">
		<tr>
			<td>
				<form id="note_form">
					<input type="hidden" name="note_title" id="note_title" value="우하하하하하하하하하하  TiStory BizBroker 2.0 셈플">
					<input type="hidden" name="note_contents" id="note_contents" value="본문 요약 셈플입니다.">
					<input type="hidden" name="note_comment" id="note_comment" value="무단 복제 및 전체를 금지 합니다.">
				<table border="0" id="SNS_RE_MAIN">
					<tr>
						<td rowspan="2" valign="top" align="center">
							<img src="images/snsIcons/yak.png">	   			
						</td>
						<td colspan="3">							
							<textarea name="note_main" id="note_main" rows="3" cols="50"></textarea>
						</td>
					</tr>
					<tr>						
						<td>
							<input type="checkbox" name="s_fb" id="s_fb"><a href="#" onclick="openLoginDialog('facebook')"><img src="images/snsIcons/btn_rep_sns_facebook_glay.gif"></a>
							<input type="checkbox" name="s_tw" id="s_tw"><a href="#" onclick="openLoginDialog('twitter')"><img src="images/snsIcons/btn_rep_sns_twitter.gif"></a>
							<input type="checkbox" name="s_clog" id="s_clog"><a href="#" onclick="openLoginDialog('nate.clog')"><img src="images/snsIcons/btn_rep_sns_clog_glay.gif"></a>
							<input type="checkbox" name="s_mday" id="s_mday"><a href="#" onclick="openLoginDialog('naver.me2day')"><img src="images/snsIcons/btn_rep_sns_me2day_glay.gif"></a>
							<input type="checkbox" name="s_yzm" id="s_yzm"><a href="#" onclick="openLoginDialog('daum.yozm')"><img src="images/snsIcons/btn_rep_sns_yozeem_glay.gif"></a>
<!-- 						<input type="checkbox" name="s_wb" id="s_wb"><a href="#" onclick="openLoginDialog('sina.weibo')"><img src="images/snsIcons/btn_rep_sns_sina_weibo.png"></a>  -->
							<input type="checkbox" name="s_dt" id="s_dt"><a href="#" onclick="openLoginDialog('daum.tistory')"><img src="images/snsIcons/btn_rep_sns_tistory.gif"></a>
						</td>
						<td align="left">0/150자</td>
						<td align="left"><input type="button" id="regist" value="댓글등록" onclick="savePost()"></td>
					</tr>
					<tr>
						<td colspan="4" height="10"></td>
					</tr>
					<tr>
						<td colspan="4">
							<table border="0">
								<tr>
									<td>
										<img src="images/snsIcons/btn_rep_sns_facebook_glay.gif">
										<img src="images/snsIcons/btn_rep_sns_twitter.gif">
										<img src="images/snsIcons/btn_rep_sns_clog_glay.gif">
										<img src="images/snsIcons/btn_rep_sns_yozeem_glay.gif">
									</td>
									<td> | </td>
									<td>2012-01-25 13:39:28</td>
									<td>공감0</td>
								</tr>
								<tr>
									<td colspan="4">이런 기능도 있겠군요..</td>
									<td><input type="button" value="댓글쓰기"><input type="button" value="삭제"></td>
								</tr>								
							</table>
						</td>
					</tr>			
				</table>
				</form>
			</td>
		</tr>
	</table>
</body>
</html>